package com.gxa.controller.gouhuocontroller;

import com.gxa.common.R;
import com.gxa.pojo.GouHuoTuiHuo;
import com.gxa.service.gouhuoservice.GouHuoDan46Service;
import com.gxa.service.gouhuoservice.GouHuoTuiHuoDan46Service;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Date;
import java.util.ArrayList;

/**
 * @Author x
 */

@RestController
@RequestMapping("/GouHuoTuiHuoDanJiLu")
@Api(value = "退货单记录" , tags = "退货数据接口API")

@RequiresPermissions("购货退货单记录")
public class GouHuoDanTuiHuoJiLuController {


    @Autowired(required = false)
    public R r;

    @Autowired(required = false)
    GouHuoTuiHuoDan46Service gouHuoTuiHuoService;
    @ApiResponses({
            @ApiResponse(code = 200,message = "请求成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })

    @RequestMapping(value = "/selectAllGouHuoTuiHuoDanForPage",method = RequestMethod.GET)
    @ApiOperation(value = "购货退货单纪律表" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "每页显示条数", required = true,dataType = "int",paramType = "query")
    })
    public R selectAllGouHuoTuiHuoDanForPage(int page,int size) {
//        r.setCode(200);
//        r.setMsg("success");
//        r.setCode(200);
//        r.setMsg("查询成功");
//        ArrayList<Object> list = new ArrayList<>();
//        list.add("jjj");
//        r.setData(list);
//        return r;
        return  gouHuoTuiHuoService.selectAllGouHuoTuiHuoDanForPage(page,size);
    }

    @RequestMapping(value = "/selectAllGouHuoTuiHuoDan",method = RequestMethod.GET)
    @ApiOperation(value = "查询退货购货单纪律" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "danJuBianHao",value = "输入单据编号查询",required = false,dataType = "String",paramType = "query"),//            @ApiImplicitParam(name = "gongYinShangMingCheng",value = "输入供应商查询", required = false,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "beiZhu",value = "输入备注查询", required = false,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "每页显示条数", required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "danJuRiQi",value = "日期", required = false,dataType = "date",paramType = "query"),
            @ApiImplicitParam(name = "shenHeZhuangTai",value = "审核状态", required = false,dataType = "int",paramType = "query"),
    })
    public R selectAllGouHuoTuiHuoDan(int page, int size,
                                Date danJuRiQi, int shenHeZhuangTai, String danJuBianHao, String beiZhu) {
//        r.setCode(200);
//        r.setMsg("success");
//        ArrayList<Object> list = new ArrayList<>();
//        GouHuoTuiHuo gouHuoTuiHuo = new GouHuoTuiHuo();
//        gouHuoTuiHuo.setBeiZhu("233");
//        gouHuoTuiHuo.setDanJuBianHao("33");
//        gouHuoTuiHuo.setDanJuBianHao("国信安");
//        list.add(gouHuoTuiHuo);
//        r.setData(list);
//        return r;
        return  gouHuoTuiHuoService.selectAllGouHuoTuiHuoDan( page,  size,
                danJuRiQi,  shenHeZhuangTai,  danJuBianHao,  beiZhu);

    }

    @RequestMapping(value = "/deletidGouHuoTuiHuoDan",method = RequestMethod.POST)
    @ApiOperation(value = "删除购货退货单" ,notes = "提供当前页码数与每页显示条数",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "删除该条记录",required = true,dataType = "int",paramType = "query")
    })
    public R deletidGouHuoTuiHuoDan(int id)
    {
//        r.setCode(200);
//        r.setMsg("success");
//        ArrayList<Object> list = new ArrayList<>();
//        GouHuoTuiHuo gouHuoTuiHuo = new GouHuoTuiHuo();
//        gouHuoTuiHuo.setId(5);
//        list.add(gouHuoTuiHuo);
//        r.setData(list);
//        return r;
        return gouHuoTuiHuoService.deleteGouHuoTuiHuoById(id);
    }

//    @RequestMapping(value = "/selectByGouHuoDanJiLuTui",method = RequestMethod.GET)
//    @ApiOperation(value = "审核购货退货单纪律" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "shuLiang",value = "数量",required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "gouHuoDanJia",value = "购货单价", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "zheKouLv",value = "折扣率", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "zheKouE",value = "折扣额", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "gouHuoJinE",value = "购货金额", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "beiZhu",value = "备注", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "shangPin",value = "商品", required = true,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "cangKu",value = "仓库", required = true,dataType = "String",paramType = "query")
//    })
//    public R selectByGouHuoDanJiLuTui(String shuLiang,String guoHuoDanJia,String zheKouLv,String zheKouE,String gouHuoJinE,
//                                      String beiZhu,String shangPin,String cangKu) {
//        r.setCode(200);
//        r.setMsg("success");
//        ArrayList<Object> list = new ArrayList<>();
//        GouHuoTuiHuo gouHuoTuiHuo = new GouHuoTuiHuo();
//        gouHuoTuiHuo.setBeiZhu("233");
//        list.add(gouHuoTuiHuo);
//        r.setData(list);
//        return r;
//    }
//
//    @RequestMapping(value = "/selectByGouHuoDanJiLuFanTui",method = RequestMethod.GET)
//    @ApiOperation(value = "返审核购货退货单纪律" ,notes = "提供当前页码数与每页显示条数",httpMethod = "get",response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "shuLiang",value = "数量",required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "gouHuoDanJia",value = "购货单价", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "zheKouLv",value = "折扣率", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "zheKouE",value = "折扣额", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "gouHuoJinE",value = "购货金额", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "beiZhu",value = "备注", required = false,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "shangPin",value = "商品", required = true,dataType = "String",paramType = "query"),
//            @ApiImplicitParam(name = "cangKu",value = "仓库", required = true,dataType = "String",paramType = "query")
//    })
//    public R selectByGouHuoDanJiLuFanTui(String shuLiang,String guoHuoDanJia,String zheKouLv,String zheKouE,String gouHuoJinE,
//                                         String beiZhu,String shangPin,String cangKu) {
//        r.setCode(200);
//        r.setMsg("success");
//        ArrayList<Object> list = new ArrayList<>();
//        GouHuoTuiHuo gouHuoTuiHuo = new GouHuoTuiHuo();
//        gouHuoTuiHuo.setBeiZhu("233");
//        list.add(gouHuoTuiHuo);
//        r.setData(list);
//        return r;
//    }
    @RequestMapping(value = "/ShenHeGouHuoTuiHuoDanJiLu", method = RequestMethod.POST)
    @ApiOperation(value = "审核购货退货单记录", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shenHeZhuangTai", value = "审核状态", required = true, dataType = "int", paramType = "query")

    })
    public R ShenHeGouHuoTuiHuoDanJiLu(@RequestParam int shenHeZhuangTai) {
        return  gouHuoTuiHuoService.ShenHeGouHuoTuiHuoDanJiLu(shenHeZhuangTai);
    }

        @RequestMapping(value = "/ShenHeGouHuoTuiHuoDanJiLuFan", method = RequestMethod.POST)
        @ApiOperation(value = "反审核购货退货单记录", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
        @ApiImplicitParams({
                @ApiImplicitParam(name = "shenHeZhuangTai", value = "审核状态", required = true, dataType = "int", paramType = "query")

        })
        public R ShenHeGouHuoTuiHuoDanJiLuFan(@RequestParam int shenHeZhuangTai) {
            return  gouHuoTuiHuoService.ShenHeGouHuoTuiHuoDanJiLuFan(shenHeZhuangTai);
    }
}

